:root {
    --primary-color: #2563eb;
    /* 更鲜明的主色调 */
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --light-gray: #f8fafc;
    --mid-gray: #e2e8f0;
    --dark-gray: #334155;
    --border-radius: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
    --transition-fast: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    background-color: #f1f5f9;
    padding: 20px 15px;
}

.container {
    max-width: 100%;
    /* 增加最大宽度 */
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--mid-gray);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.header-icon {
    color: var(--primary-color);
    font-size: 1.5rem;
}

h1 {
    color: var(--primary-color);
    font-weight: 600;
    margin: 0;
}

.subtitle {
    color: var(--secondary-color);
    font-weight: 400;
    font-size: 1.1rem;
}

.input-section {
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    gap: 12px;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

#urlInput {
    width: 100%;
    padding: 12px 15px;
    padding-right: 40px;
    border: 1px solid var(--mid-gray);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

#urlInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 实时验证提示 */
.validation-hint {
    margin-top: 6px;
    font-size: 0.85rem;
    height: 1.2rem;
    color: var(--danger-color);
}

.clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.clear-btn.visible {
    opacity: 1;
    visibility: visible;
}

.clear-btn:hover {
    background-color: var(--light-gray);
    color: var(--danger-color);
}

.btn-primary {
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    margin-left: auto;
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background-color: var(--mid-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#promptInput {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--mid-gray);
    border-radius: var(--border-radius);
    font-size: 15px;
    transition: var(--transition);
    resize: vertical;
    min-height: 140px;
    height: auto;
    font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

#promptInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 加载动画 */
.loading-spinner {
    font-size: 1.2rem;
}

.result-section {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 卡片间距 */
}

.details-card {
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 20px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.details-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--mid-gray);
}

/* 浮窗样式 */
#detailTooltip {
    position: fixed;
    /* 相对于视口定位 */
    top: 50px;
    left: 50px;
    border: 1px solid #ccc;
    background: white;
    padding: 16px;
    max-width: 60%;
    /* 限制最大宽度（避免过宽） */
    max-height: 80%;
    /* 限制最大高度（避免过高） */
    overflow: auto;
    /* 内容超出最大尺寸时显示滚动条 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: -1;
    /* 默认隐藏时在最底层 */
}

#detailTooltip.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
    z-index: 9999;
    /* 显示时在最上层 */
}

#detailTooltip:hover {
    background-color: #d8e1f1;
}

.tooltip-content {
    max-height: 500px;
    margin-bottom: 8px;
}

.tooltip-content pre {
    background-color: var(--light-gray);
    padding: 8px;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
    margin: 8px 0;
}

.tooltip-content p {
    margin: 8px 0;
}

.tooltip-title {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--mid-gray);
}

.card-title {
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--mid-gray);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-icon {
    color: var(--primary-color);
}

.result-content {
    padding: 15px;
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--mid-gray);
    min-height: 80px;
    font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    overflow-x: auto;
}

/* Add text highlighting capabilities for result-content */
.result-content .highlight-error {
    color: var(--danger-color);
    font-weight: 500;
}

.result-content .highlight-warning {
    color: var(--warning-color);
    font-weight: 500;
}

.result-content .highlight-success {
    color: var(--accent-color);
    font-weight: 500;
}

.result-content .highlight-info {
    color: var(--secondary-color);
    font-weight: 500;
}

.result-content .highlight-neutral {
    color: var(--secondary-color);
    font-weight: 500;
}

/* 代码片段高亮 */
.code-snippet {
    background-color: #f8fafc;
    border-left: 3px solid var(--primary-color);
}

.basic-info-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    /* 响应式网格布局 */
    gap: 15px;
    padding: 10px 0;
}

.basic-info-item {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--mid-gray);
}

.basic-info-item strong {
    color: var(--secondary-color);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.basic-info-item span {
    word-break: break-all;
    font-size: 0.95rem;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--mid-gray);
}

.files-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    min-width: 600px;
    /* 确保表格在小屏幕可滚动 */
}

.files-table th,
.files-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--mid-gray);
}

.files-table th {
    background-color: var(--light-gray);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary-color);
    position: relative;
    top: 0;
    z-index: 10;
    cursor: pointer;
    user-select: none;
}

.files-table th:hover {
    background-color: #e9ecef;
}

.files-table th.sorted {
    background-color: #e0f2fe;
}

.sort-indicator {
    margin-left: 8px;
    font-size: 12px;
}

.files-table th[data-sort] {
    padding-right: 10px;
    cursor: pointer;
}

.files-table tr:hover {
    background-color: rgba(37, 99, 235, 0.03);
}

.files-table tr:last-child td {
    border-bottom: none;
}

.files-table .issue-type {
    cursor: pointer;
}

#data-table tr {
    cursor: pointer;
    height: 50px;
    overflow: hidden;
}

#data-table td {
    white-space: nowrap;
    /* 禁止文本换行 */
    overflow: hidden;
    /* 超出部分隐藏 */
    text-overflow: ellipsis;
    /* 显示省略号 */
    vertical-align: middle;
    /* 文本垂直居中 */
    max-width: 0;
    /* 配合ellipsis实现任意宽度下的省略 */
}

#data-table th:nth-child(1),
#data-table td:nth-child(1) {
    width: 70px;
    /* 类型列 */
}

#data-table th:nth-child(2),
#data-table td:nth-child(2) {
    width: 80px;
    /* 规则ID列 */
}

#data-table th:nth-child(3),
#data-table td:nth-child(3) {
    /* max-width: 80px; */
}

#data-table th:nth-child(4),
#data-table td:nth-child(4) {
    width: 160px;
    /* 行范围列 */
}

#data-table th:nth-child(5),
#data-table td:nth-child(5) {
    /* 文件名称列 */
    max-width: 40px;
}

.status-merged {
    color: var(--accent-color);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-merged::before {
    content: "✓";
}

.status-open {
    color: var(--primary-color);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-open::before {
    content: "○";
}

.status-abandoned {
    color: var(--danger-color);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-abandoned::before {
    content: "✕";
}

/* 问题等级样式 */
.level-S {
    color: var(--danger-color);
    font-weight: 500;
}

.level-A {
    color: var(--warning-color);
    font-weight: 500;
}

.level-BC {
    color: var(--primary-color);
    font-weight: 500;
}

/* 抽屉样式 */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100%;
    /* 移动端全屏 */
    height: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(100%);
    /* 初始隐藏 */
    transition: transform 0.3s ease;
}

.drawer.open {
    transform: translateX(0);
    /* 显示时滑入 */
}

.drawer-content {
    height: 100%;
    padding: 25px 20px 20px;
    overflow-y: auto;
}

.drawer-title {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--mid-gray);
}

.detail-item {
    margin-bottom: 20px;
}

.detail-item h4 {
    margin-bottom: 8px;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--secondary-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    z-index: 10;
}

.close-btn:hover {
    color: var(--danger-color);
    background-color: var(--light-gray);
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

    .input-group {
        flex-direction: column;
    }

    .basic-info-list {
        grid-template-columns: 1fr;
        /* 移动端单列 */
    }

    .drawer {
        width: 100%;
    }
}

/* 动画类 */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 在styles.css中添加选项样式 */
.analysis-options {
    background-color: var(--light-gray);
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--mid-gray);
}

.option-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.option-item:last-child {
    margin-bottom: 0;
}

.option-item input {
    margin-right: 8px;
    width: 16px;
    height: 16px;
}

.option-item label {
    cursor: pointer;
    color: var(--dark-gray);
    font-size: 0.95rem;
}

.btn-excelBtn {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    position: absolute;
    right: 2%;
}

.btn-excelBtn:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
}

/* 弹窗动画样式 */
#approvalPopup>div {
    transform: scale(0.95);
    transition: transform 0.2s ease-out;
}

#approvalPopup>div.scale-100 {
    transform: scale(1);
}

/* 分页按钮基础样式 */
.page-btn {
    padding: 4px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: white;
    background-color: var(--primary-light);
    cursor: pointer;
    font-size: 14px;
    margin: 0 2px;
}

/* 悬停效果 */
.page-btn:hover {
    background-color: var(--primary-color);
}

/* 禁用状态 */
.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    /* 阻止点击事件 */
}

/* 当前页样式 */
.page-btn.current {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* 中间页码按钮基础样式 */
.medium-page-btn {
    padding: 4px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: black;
    background-color: white;
    cursor: pointer;
    font-size: 14px;
    margin: 0 2px;
}

/* 悬停效果 */
.medium-page-btn:hover {
    background-color: var(--primary-color);
}

/* 禁用状态 */
.medium-page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    /* 阻止点击事件 */
}

/* 当前页样式 */
.medium-page-btn.current {
    background-color: #6195e9;
    color: white;
    border-color: #3b82f6;
}


/* 分页容器 */
.pagination {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 20px 0;
}

.table-filters {
    padding: 15px;
    background-color: var(--light-gray);
    border-bottom: 1px solid #ddd;
}

.search-box {
    padding: 8px 12px;
    width: 300px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-group {
    display: inline-block;
    margin-left: 15px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background-color: var(--light-gray);
    border-top: 1px solid #ddd;
}

/* 过渡动画基础样式 */
.transition-opacity {
    transition-property: opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.duration-300 {
    transition-duration: 300ms;
}

.opacity-0 {
    opacity: 0;
}

#centerText {
    position: absolute;
    top: 0;
    left: 0;
    text-align: center;
    white-space: nowrap;
    background: transparent;
    pointer-events: none; /* 防止中心文本干扰鼠标事件 */
    z-index: 100; /* 确保在饼图上方显示 */
}

#issuesDistributionContainer {
    position: relative;
}

#issuesDistributionChartPie {
    z-index: 1;
}